#ifndef TC_DYNTRACE_HH
#define TC_DYNTRACE_HH

/** \file DynTrace.hh 
 * Declarations for Dynamic Trace macros
 *
 * (c) Copyright  Semih Cemiloglu
 * All rights reserved, see COPYRIGHT file for details.
 *
 * $Id: Log.hh,v 1.3 2008/10/09 04:51:41 bdssadm Exp $
 *
 *
 */

// Project headers
#include "Global.hh"
#include "Trace.hh"
#include "AutoPtr.hpp"



#ifdef TC_NOTRACE
# define TC_DYNTRACE        ((void)0)
# define TC_DYNTRACE_ID(Id) ((void)0)
#else
# define TC_DYNTRACE \
  static ::TC::CodeContext __context(__FILE__, __LINE__, TC_FUNCTION); \
  ::TC::AutoPtr< ::TC::Trace > __dyn_trace(                            \
      (::TC::Trace::s_GlobalEnable &&                                  \
       ::TC::Trace::s_ThreadEnable) ?                                  \
      new ::TC::Trace(&__context) : 0)
# define TC_DYNTRACE_ID(Id) \
  static ::TC::CodeContext __context(__FILE__, __LINE__, Id);  \
  ::TC::AutoPtr< ::TC::Trace > __dyn_trace_id(                 \
      (::TC::Trace::s_GlobalEnable &&                          \
       ::TC::Trace::s_ThreadEnable) ?                          \
      new Trace(&__context) : 0)
#endif

#endif /* Include guard */
